package com.cool.islife.controller;

import com.cool.islife.mapper.UserMapper;
import com.cool.islife.service.TestServiceImpl;
import com.cool.islife.service.UserService;
import com.cool.islife.vo.UserVO;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: xiaotao
 * Date: 2018-1-24
 * Time: 22:04
 */
@RestController
public class HelloController {
    @Autowired
    UserMapper userMapper;
    @Autowired
    TestServiceImpl testService;
    @Autowired
    UserService userService;

    @RequestMapping("/hello")
    public String index(@RequestParam String user) {

        PageHelper.startPage(1, 1);
        List<UserVO> s = userMapper.selectAll();


        Map a = new HashMap();
        List<Map> sss = userMapper.selectByName(a);

        return "Hello World";
    }

    @RequestMapping("/exce")
    public String exce() {
        testService.test1();
        return "Hello World";
    }

    @RequestMapping("/test")
    public String test() {
        return "Hello World";
    }

    @RequestMapping("/list")
    public Object list() {
        return userService.list();
    }

    @GetMapping("/get/{id}")
    public Object get(@PathVariable("id")Long id) {
        return userService.get(id);
    }
    @RequestMapping("/delete")
    public Object delete(Long id) {
        return userService.delete(id);
    }
}
